package com.blankland.dataanalysis.config.swagger.mybatis;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MybatisPlus分页插件的配置类
 */
@Configuration
public class MybatisPlusConfig {

    //分页插件的配置文件（固定写法）
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(
                //设置数据库版本
                new PaginationInnerInterceptor(DbType.MYSQL)
        );
        return interceptor;
    }
}
